avatar Bite 199. Multiple inheritance (__mro__)

Implement the following class structure: print(Child.__mro__):

(<class '__main__.Child'>,
 <class '__main__.Father'>,
 <class '__main__.Mother'>,
 <class '__main__.Person'>,
 <class 'object'>)

Each class has the following string representation:

person = Person()
dad = Father()
mom = Mother()
child = Child()

print(person)
print(dad)
print(mom)
print(child)

Output:

I am a person
I am a person and cool daddy
I am a person and awesome mom
I am the coolest kid

You should use inheritance here, so the I am a person substring should only occur in the Person base class.

Good luck and keep calm and code in Python!

Login and get coding
go back Intermediate level
Bitecoin 3X

Will you be the 222nd person to crack this Bite?
Resolution time: ~29 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 2.27 on a 1-10 difficulty scale.
» You can do it! 😌

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help